﻿* Encoding: UTF-8.

/*SPSS syntax for generating Figures 2,3 and 4 in "It's the End of the World and They Know It: How Dystopian Fiction Shapes Political Attitudes"
/* Use Clean_First3_Dy6stop.sav dataset

VARIABLE LABELS 
j_disobed "Civil Disobedience"
j_semivio "Damaging Action Index"
j_realvio "Violent Action Index"
rel_violence "Violence as Necessary".
Execute.

IF whichdata = 1 and condition = 1 study1condition = 1.
IF whichdata = 1 and condition = 2 study1condition = 2.
IF whichdata = 1 and condition = 3 study1condition = 3.
IF whichdata = 2 and condition = 1 study2condition = 1.
IF whichdata = 2 and condition = 4 study2condition = 2.
IF whichdata = 2 and condition = 3 study2condition = 3.
IF whichdata = 3 and condition = 1 study3condition = 1.
IF whichdata = 3 and condition = 5 study3condition = 2.
IF whichdata = 3 and condition = 3 study3condition = 3.


VALUE LABELS
study1condition
1 "Hunger Games"
2 "Divergent"
3 "Control".
Execute.

VALUE LABELS
study2condition
1 "Hunger Games"
2 "Fast and Furious"
3 "Control".
Execute.

VALUE LABELS
study3condition
1 "Hunger Games"
2 "Nonfiction"
3 "Control".
Execute.

/* Chart builder for Figure 2, Study 2 results. Y axis number format, bar colors, connector lines and asterisks are added manually.

USE ALL.
COMPUTE filter_$=(MISSING(J_disobed) + MISSING(j_damage) + MISSING(j_cyber) + MISSING(j_violent) +
    MISSING(j_rebel) + MISSING(rel_violence) = 0 and whichdata = 2).
VARIABLE LABELS filter_$ 'MISSING(J_disobed) + MISSING(j_damage) + MISSING(j_cyber) + '+
    'MISSING(j_violent) + MISSING(j_rebel) + MISSING(rel_violence) = 0 and whichdata = 2 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=MEAN(j_disobed) MEAN(j_semivio) MEAN(j_realvio)
    MEAN(rel_violence) study2condition MISSING=LISTWISE REPORTMISSING=NO
    TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX")
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: SUMMARY=col(source(s), name("#SUMMARY"))
  DATA: INDEX=col(source(s), name("#INDEX"), unit.category())
  DATA: study2condition=col(source(s), name("study2condition"), unit.category())
  COORD: rect(dim(1,2), cluster(3,0))
  GUIDE: axis(dim(2), label("Mean score (recoded on 0-1 scale)"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label(""))
  SCALE: cat(dim(3), include("0", "1", "2", "3"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("1.00", "2.00", "3.00"), sort.natural(),
    reverse())
  SCALE: cat(dim(1), include("1.00", "2.00", "3.00"), sort.natural(), reverse())
  ELEMENT: interval(position(study2condition*SUMMARY*INDEX), color.interior(study2condition),
    shape.interior(shape.square))
END GPL.


/* Chart builder for Figure 3, Study 3 results. Y axis number format, bar colors, connector lines and askterisks are added manually.

USE ALL.
COMPUTE filter_$=(MISSING(J_disobed) + MISSING(j_damage) + MISSING(j_cyber) + MISSING(j_violent) +
    MISSING(j_rebel) + MISSING(rel_violence) = 0 and whichdata = 3).
VARIABLE LABELS filter_$ 'MISSING(J_disobed) + MISSING(j_damage) + MISSING(j_cyber) + '+
    'MISSING(j_violent) + MISSING(j_rebel) + MISSING(rel_violence) = 0 and whichdata = 3 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=MEAN(j_disobed) MEAN(j_semivio) MEAN(j_realvio)
    MEAN(rel_violence) study3condition MISSING=LISTWISE REPORTMISSING=NO
    TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX")
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: SUMMARY=col(source(s), name("#SUMMARY"))
  DATA: INDEX=col(source(s), name("#INDEX"), unit.category())
  DATA: study3condition=col(source(s), name("study3condition"), unit.category())
  COORD: rect(dim(1,2), cluster(3,0))
  GUIDE: axis(dim(2), label("Mean score (recoded on 0-1 scale)"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label(""))
  SCALE: cat(dim(3), include("0", "1", "2", "3"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("1.00", "2.00", "3.00"))
  SCALE: cat(dim(1), include("1.00", "2.00", "3.00"))
  ELEMENT: interval(position(study3condition*SUMMARY*INDEX), color.interior(study3condition),
    shape.interior(shape.square))
END GPL.

/*Chart builder for Figure 4, Pooled results comparing Hunger Games to Control across the three studies. Y axis number format, bar colors, and asterisks are added manually.
 
IF  (study1condition = 1 or study2condition = 1 or study3condition=1) PooledCondition=1. 
EXECUTE. 
IF  (study1condition = 3 or study2condition = 3 or study3condition=3) PooledCondition=3. 
EXECUTE.

VALUE LABELS
PooledCondition
1 "Hunger Games"
3 "Control".
Execute.

USE ALL.
COMPUTE filter_$=(MISSING(j_disobed) + MISSING(j_damage) + MISSING(j_cyber) + MISSING(j_violent) +
    MISSING(j_rebel) + MISSING(rel_violence) = 0).
VARIABLE LABELS filter_$ 'MISSING(J_disobed) + MISSING(j_damage) + MISSING(j_cyber) + '+
    'MISSING(j_violent) + MISSING(j_rebel) + MISSING(rel_violence) = 0 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=MEAN(j_disobed) MEAN(j_semivio) MEAN(j_realvio)
    MEAN(rel_violence) PooledCondition MISSING=LISTWISE REPORTMISSING=NO
    TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX")
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: SUMMARY=col(source(s), name("#SUMMARY"))
  DATA: INDEX=col(source(s), name("#INDEX"), unit.category())
  DATA: PooledCondition=col(source(s), name("PooledCondition"), unit.category())
  COORD: rect(dim(1,2), cluster(3,0))
  GUIDE: axis(dim(2), label("Mean score (recoded on 0-1 scale)"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label(""))
  SCALE: cat(dim(3), include("0", "1", "2", "3"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("1.00", "3.00"))
  SCALE: cat(dim(1), include("1.00", "3.00"))
  ELEMENT: interval(position(PooledCondition*SUMMARY*INDEX), color.interior(PooledCondition),
    shape.interior(shape.square))
END GPL.







